
class Login{
    public String userName = "huiliyi";
    public String passWorld = "123456";

    public void logIn(String userName,String passWorld) {
        if(!this.userName.equals(userName)){
            //System.out.println("用户名错误！");
            throw new UseNameExeption("用户名错误！");
        }

        if(!this.passWorld.equals(passWorld)){
            //System.out.println("密码错误！");
            throw new UseNameExeption("密码错误！");
        }
    }
}

public class Text {
    public static void main(String[] args) {
        try{
            Login login = new Login();
            login.logIn("huiliyi","12345");
        }catch (UseNameExeption e){
            e.printStackTrace();
        }
    }
}
